import request from '@/utils/request'

export function getRegionUsableList(query) {
  let baseUrl = "/geography/region"
  if(query != undefined){
    if(typeof query == "object"){
      console.log(query)
      if(query.hasOwnProperty('regionID')){
        query['regionID'] = parseInt(query['regionID'])
        if(isNaN(query['regionID']) == false){
          baseUrl = baseUrl+"-"+query['regionID']
        }
      }
    }
  }
  return request({
    url: baseUrl,
    method: 'get'
  })
}

export function getRegionList(query) {
  return request({
    url: '/geography/admin/region/getList',
    method: 'post',
    data: query
  })
}
export function saveRegion(query) {
  return request({
    url: '/geography/admin/region/save',
    method: 'post',
    data: query
  })
}

export function removeRegion(query) {
  return request({
    url: '/geography/admin/region/remove',
    method: 'post',
    data: query
  })
}
export function getRegionDetail(query) {
  if(query != undefined){
    query = JSON.parse(JSON.stringify(query))
  }
  return request({
    url: '/geography/admin/region/info/0',
    method: 'get',
    data: query
  })
}